package library.service.impl;

import library.config.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;
import javax.annotation.Resource;
import library.mapper.UserMapper;
import library.po.User;
import library.service.UserService;
public class UserServiceImpl implements UserService{

    @Resource
    private SqlSession sqlSession;
    private UserMapper userMapper;

    public UserServiceImpl(){
        sqlSession = MyBatisUtil.getSqlSession();
        userMapper = sqlSession.getMapper(UserMapper.class);
    }

    @Override
    public int deleteById(String userId) {
        return userMapper.deleteById(userId);
    }

    @Override
    public int insert(User record) {
        return userMapper.insert(record);
    }

    @Override
    public int insertSelective(User record) {
        return userMapper.insertSelective(record);
    }

    @Override
    public User selectById(String userId) {
        return userMapper.selectById(userId);
    }

    @Override
    public int updateSelective(User record) {
        return userMapper.updateSelective(record);
    }

    @Override
    public int updateById(User record) {
        return userMapper.updateById(record);
    }

    @Override
    public void updatePassword(User user){
        userMapper.updatePassword(user);
    }

    @Override
    public User login(User noTypeUser){
        return userMapper.login(noTypeUser);
    }
    @Override
    public User judgeIdentity(User user){
        return userMapper.judgeIdentity(user);
    }
}
